{layout name="public::layout" /}

<h4 class="text-center text-success">分类管理</h4>

<table class="table table-default table-striped table-bordered table-hover text-center">
    <tr>
        <td>ID</td>
        <td>栏目名称</td>
        <td>排序</td>
        <td>状态</td>
        <td>创建时间</td>
        <td colspan="2">操作</td>
    </tr>
    {volist name="cateList" id="cate" empty="$empty"}
    <tr>
        <td>{$cate.id}</td>
        <td>{$cate.name}</td>
        <td>{$cate.sort}</td>
        {eq name="$cate.status" value="1"}
        <td style="color: forestgreen">显示</td>
        {else}
        <td style="color: gray">隐藏</td>
        {/eq}
        <td>{$cate.create_time}</td>
        <td><a href="{:url('cate/cateEdit',['id'=>$cate.id])}">编辑</a></td>
        <td><a href="{:url('cate/doDelete',['id'=>$cate.id])}" onclick="dele();">删除</a></td>
    </tr>
    {/volist}
</table>

<a class="btn btn-info" href="{:url('cate/cateAdd')}" role="button">添加分类</a>

<script>
    function dele() {
        if (confirm('您是真的要删除吗？') == true){
            window.location.href = "{:url('cate/doDelete',['id'=>$cate.id])}";
        }
    }
</script>